package com.icangya.DAO.impl;

import com.icangya.DAO.IRwBankDAO;
import com.icangya.domain.RwBank;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class RwBankDAOImpl extends  BaseDAO<RwBank> implements IRwBankDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public List<RwBank> getBankByUserid(long userid) {

        String hql=" FROM RwBank bugcar where bugcar.userid = ? ";

        List<RwBank> list=(List<RwBank>) getHibernateTemplate().find(hql,userid);

        if(list.size()>0){

            return list;

        }
        return null;
    }

    @Override
    public RwBank getUserbankCardBybankid(long id) {
        String hql=" FROM RwBank bugcar where bugcar.id = ? ";

        List<RwBank> list=(List<RwBank>) getHibernateTemplate().find(hql,id);

        if(list.size()>0){

            return list.get(0);

        }
        return null;
    }


}
